import serial

# Configure the serial port
DEVICE_PATH = "/dev/ttyS3"  # Adjust if needed
BAUD_RATE = 115200  # Change based on your device

# Open the serial port
with serial.Serial(DEVICE_PATH, BAUD_RATE, timeout=1) as ser:
    # Hex data as a byte array
    hex_data = bytes.fromhex("7E 01 00 00 00 00 AA")

    # Write data to the serial port
    ser.write(hex_data)
    print(f"Sent: {hex_data.hex().upper()}")

    # Optional: Read response from the device
    response = ser.read(10)  # Adjust number of bytes to read
    if response:
        print(f"Received: {response.hex().upper()}")

